{extend name="public:adminbase" /}

{block name="content"}


<style>
  .form-group {
    margin-bottom: 40px;
  }
</style>
<div class="container-fluid p-t-15">

  <div class="row">
    <div class="col-lg-6">
      <div class="card">
        <ul class="nav nav-tabs page-tabs">
          {include file="AdminSetting/nav"}
        </ul>
        <div class="tab-content">
          <div class="tab-pane active">

            <form onsubmit="return false;" method="post" name="edit-form" class="edit-form">
              <div class="form-group">
                <label for="web_site_title">app_id</label>
                <input class="form-control"
                       type="text"
                       id="web_site_title"
                       name="app_id"
                       value="{:config('web.app_id')}"
                       placeholder="请输入" >
                <small class="help-block">调用方式：<code>config('web.app_id')</code></small>
              </div>

              <div class="form-group">
                <label for="web_site_title">app_token</label>
                <input class="form-control"
                       type="text"
                       name="app_token"
                       value="{:config('web.app_token')}"
                       placeholder="请输入app_token" >
                <small class="help-block">调用方式：<code>config('web.app_token')</code></small>
              </div>

              <div class="form-group">

                <small class="help-block">温馨提示：<code>
                  先开通百度百家号，在开发->基本配置 中找到相应数据填写，可一键同步文章到百家号。
                </code></small>
              </div>

              <div class="form-group">
                <button type="submit" onclick="formsub()" class="btn btn-primary m-r-5">确 定</button>
                <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
              </div>
            </form>

          </div>
        </div>

      </div>
    </div>

  </div>

</div>
{include file="public/afooter"}
<script>

  function formsub() {
    var data = $("form").serialize();
    var url = "{:url('AdminSetting/save')}"
    $.post(url,data,function (e) {
      if(e.code != 200){
        error(e.msg);
      }else {
        success(e.msg);
        setTimeout(location.reload(), 1000);

      }
    })
  }
//  新增
  function AddCate(obj) {
    var url = $(obj).attr('href');
    layer.open({
      title:"新增分类",
      type: 2,
      area: ['500px', '450px'],
      fixed: false, //不固定
      maxmin: true,
      content: url
    });
  }
//修改
//  function edit(obj) {
//    var url = $(obj).attr('href');
//    layer.open({
//      title:"修改",
//      type: 2,
//      area: ['500px', '450px'],
//      fixed: false, //不固定
//      maxmin: true,
//      content: url
//    });
//  }
//  删除
  function del(id) {
    layer.confirm('您确定要删除吗？', {
      btn: ['确定','取消'] //按钮
    }, function(){
      var url = "{:url('AdminCate/delete')}"
      $.post(url,{id:id},function (e) {
        if(e.code != 200){
          error(e.msg);
        }else {
          success(e.msg);
          var index = parent.layer.getFrameIndex(window.name);
          setTimeout(function(){parent.layer.close(index)}, 1000);
          window.parent.location.reload();
        }
      })
    }, function(){
      layer.msg('已取消');
    });
  }

  //修改置顶状态
  function change_top(id) {
    var url ="{:url('change_top')}";
    $.post(url,{id:id},function (e) {
      if(e.code ==200){
        success(e.msg);
        setTimeout(location.reload(),1000);
      } else {
        error(e.msg);
      }
    })
  }
  //修改推荐状态

function change_recommend(id) {
  var url ="{:url('change_recommend')}";
  $.post(url,{id:id},function (e) {
    if(e.code ==200){
      success(e.msg);
      setTimeout(location.reload(),1000);
    } else {
      error(e.msg);
    }
  })
}
</script>

{/block}